//# 1 "/tmp/tews/ov-dist/ov-chip-2-2010-09-20/gui/netbeans/ov_demo_gui/src/ds/ov2/gui/Applet_list_window.java"
// 
// OV-chip 2.0 project
// 
// Digital Security (DS) group at Radboud Universiteit Nijmegen
// 
// Copyright (C) 2009
// 
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License in file COPYING in this or one of the
// parent directories for more details.
// 
// Created 23.4.09 by Hendrik
// 
// gui code for the applet list window from the netbeans IDE
// 
// $Id: Applet_list_window.java,v 1.2 2009-05-14 17:57:29 tews Exp $

package ds.ov2.gui;

/**
 * netbeans generated code for the applet list window. This class contains
 * only the code to create the window with all its components. The
 * actions that are performed are in {@link Applet_list_actions}.
 *
 *
 * @author Hendrik Tews
 * @version $Revision: 1.2 $
 * @commitdate $Date: 2009-05-14 17:57:29 $ by $Author: tews $
 * @environment host
 * @CPP no cpp preprocessing needed
 */
public class Applet_list_window extends javax.swing.JDialog {

    /** Action instance */
    private final Applet_list_actions actions;

    /** serialVersionUID for the Serializable interface */
    public static final long serialVersionUID = 1L;

    /** Creates new form Applet_list_window */
    public Applet_list_window(java.awt.Frame parent, boolean modal, Applet_list_actions actions) {
        super(parent, modal);
        this.actions = actions;
        actions.register_applet_list_window(this);
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        applet_list_applet_table = new javax.swing.JTable();
        applet_list_show_all_check_box = new javax.swing.JCheckBox();
        applet_list_delete_button = new javax.swing.JButton();
        applet_list_select_all_button = new javax.swing.JButton();
        applet_list_close_button = new javax.swing.JButton();
        applet_list_deselect_all_button = new javax.swing.JButton();
        applet_list_refresh_button = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Applets found on the card"));

        applet_list_applet_table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Type", "Name", "delete"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Object.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(applet_list_applet_table);
        applet_list_applet_table.getColumnModel().getColumn(0).setPreferredWidth(4);
        applet_list_applet_table.getColumnModel().getColumn(1).setPreferredWidth(250);
        applet_list_applet_table.getColumnModel().getColumn(2).setPreferredWidth(4);

        applet_list_show_all_check_box.setText("show everything");
        applet_list_show_all_check_box.setToolTipText("if unchecked certain standard applets and packages are not shown");

        applet_list_delete_button.setText("Delete");
        applet_list_delete_button.setToolTipText("Delete selected applets/packages");
        applet_list_delete_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                applet_list_delete_buttonActionPerformed(evt);
            }
        });

        applet_list_select_all_button.setText("Select all");
        applet_list_select_all_button.setToolTipText("Select all applets/packages for deletion");
        applet_list_select_all_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                applet_list_select_all_buttonActionPerformed(evt);
            }
        });

        applet_list_close_button.setText("Close");
        applet_list_close_button.setToolTipText("Close the applet list dialog");
        applet_list_close_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                applet_list_close_buttonActionPerformed(evt);
            }
        });

        applet_list_deselect_all_button.setText("Deselect all");
        applet_list_deselect_all_button.setToolTipText("Select no applet/package for deletion");
        applet_list_deselect_all_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                applet_list_deselect_all_buttonActionPerformed(evt);
            }
        });

        applet_list_refresh_button.setText("Refresh");
        applet_list_refresh_button.setToolTipText("Refresh the applet list");
        applet_list_refresh_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                applet_list_refresh_buttonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addComponent(applet_list_show_all_check_box)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                                .addComponent(applet_list_select_all_button)
                                .addGap(18, 18, 18)
                                .addComponent(applet_list_delete_button))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addComponent(applet_list_refresh_button)
                                .addGap(18, 18, 18)
                                .addComponent(applet_list_deselect_all_button)
                                .addGap(18, 18, 18)
                                .addComponent(applet_list_close_button)))
                        .addGap(16, 16, 16))))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {applet_list_close_button, applet_list_delete_button, applet_list_deselect_all_button, applet_list_refresh_button, applet_list_select_all_button});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(applet_list_delete_button)
                    .addComponent(applet_list_select_all_button)
                    .addComponent(applet_list_show_all_check_box))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(applet_list_close_button)
                    .addComponent(applet_list_deselect_all_button)
                    .addComponent(applet_list_refresh_button))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(26, 26, 26))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(64, 64, 64))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void applet_list_close_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applet_list_close_buttonActionPerformed
        actions.close(this);
    }//GEN-LAST:event_applet_list_close_buttonActionPerformed

    private void applet_list_refresh_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applet_list_refresh_buttonActionPerformed
        actions.refresh(this);
    }//GEN-LAST:event_applet_list_refresh_buttonActionPerformed

    private void applet_list_select_all_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applet_list_select_all_buttonActionPerformed
        actions.select_all(this, true);
    }//GEN-LAST:event_applet_list_select_all_buttonActionPerformed

    private void applet_list_deselect_all_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applet_list_deselect_all_buttonActionPerformed
        actions.select_all(this, false);
    }//GEN-LAST:event_applet_list_deselect_all_buttonActionPerformed

    private void applet_list_delete_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applet_list_delete_buttonActionPerformed
        actions.delete_selected_applets(this);
    }//GEN-LAST:event_applet_list_delete_buttonActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Applet_list_window dialog = new Applet_list_window(new javax.swing.JFrame(), true, new Applet_list_actions(null));
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    javax.swing.JTable applet_list_applet_table;
    private javax.swing.JButton applet_list_close_button;
    private javax.swing.JButton applet_list_delete_button;
    private javax.swing.JButton applet_list_deselect_all_button;
    private javax.swing.JButton applet_list_refresh_button;
    private javax.swing.JButton applet_list_select_all_button;
    javax.swing.JCheckBox applet_list_show_all_check_box;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

}
